/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package callable;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.concurrent.Callable;

/**
 *
 * @author FERRETERIA
 */
public class Existe implements Callable<Boolean> {
        private String sql;
        private Connection conexion;

        public Existe(Connection conexion, String sql){
            this.sql = sql;
            this.conexion = conexion;
        }
        public Boolean call() throws Exception {
            // Preparamos la consulta 
            boolean valor = false;
            Statement s = conexion.createStatement(); 
            ResultSet res =  s.executeQuery (sql);
            if (res.next()) 
                valor = true;
            return valor;
        }             
}
